﻿using Microsoft.EntityFrameworkCore.Migrations;

namespace Lonewolf.Entity.Migrations
{
    public partial class AliMysql12021046 : Migration
    {
        protected override void Up(MigrationBuilder migrationBuilder)
        {
            migrationBuilder.DropPrimaryKey(
                name: "PK_roleMenus",
                table: "roleMenus");

            migrationBuilder.DropPrimaryKey(
                name: "PK_roleInfos",
                table: "roleInfos");

            migrationBuilder.DropPrimaryKey(
                name: "PK_organizationInfos",
                table: "organizationInfos");

            migrationBuilder.DropPrimaryKey(
                name: "PK_menuInfos",
                table: "menuInfos");

            migrationBuilder.DropPrimaryKey(
                name: "PK_loginInfos",
                table: "loginInfos");

            migrationBuilder.DropPrimaryKey(
                name: "PK_adminRoles",
                table: "adminRoles");

            migrationBuilder.DropPrimaryKey(
                name: "PK_adminInfos",
                table: "adminInfos");

            migrationBuilder.RenameTable(
                name: "roleMenus",
                newName: "RoleMenu");

            migrationBuilder.RenameTable(
                name: "roleInfos",
                newName: "RoleInfo");

            migrationBuilder.RenameTable(
                name: "organizationInfos",
                newName: "OrganizationInfo");

            migrationBuilder.RenameTable(
                name: "menuInfos",
                newName: "MenuInfo");

            migrationBuilder.RenameTable(
                name: "loginInfos",
                newName: "LoginInfo");

            migrationBuilder.RenameTable(
                name: "adminRoles",
                newName: "AdminRole");

            migrationBuilder.RenameTable(
                name: "adminInfos",
                newName: "AdminInfo");

            migrationBuilder.AlterColumn<bool>(
                name: "IsDelete",
                table: "RoleMenu",
                nullable: true,
                oldClrType: typeof(bool));

            migrationBuilder.AlterColumn<bool>(
                name: "IsDelete",
                table: "RoleInfo",
                nullable: true,
                oldClrType: typeof(bool));

            migrationBuilder.AlterColumn<bool>(
                name: "IsDelete",
                table: "OrganizationInfo",
                nullable: true,
                oldClrType: typeof(bool));

            migrationBuilder.AlterColumn<bool>(
                name: "IsDelete",
                table: "MenuInfo",
                nullable: true,
                oldClrType: typeof(bool));

            migrationBuilder.AlterColumn<bool>(
                name: "IsDelete",
                table: "LoginInfo",
                nullable: true,
                oldClrType: typeof(bool));

            migrationBuilder.AlterColumn<bool>(
                name: "IsDelete",
                table: "AdminRole",
                nullable: true,
                oldClrType: typeof(bool));

            migrationBuilder.AlterColumn<string>(
                name: "LoginName",
                table: "AdminInfo",
                maxLength: 50,
                nullable: true,
                oldClrType: typeof(string),
                oldNullable: true);

            migrationBuilder.AlterColumn<bool>(
                name: "IsDelete",
                table: "AdminInfo",
                nullable: true,
                oldClrType: typeof(bool));

            migrationBuilder.AddPrimaryKey(
                name: "PK_RoleMenu",
                table: "RoleMenu",
                column: "Id");

            migrationBuilder.AddPrimaryKey(
                name: "PK_RoleInfo",
                table: "RoleInfo",
                column: "Id");

            migrationBuilder.AddPrimaryKey(
                name: "PK_OrganizationInfo",
                table: "OrganizationInfo",
                column: "Id");

            migrationBuilder.AddPrimaryKey(
                name: "PK_MenuInfo",
                table: "MenuInfo",
                column: "Id");

            migrationBuilder.AddPrimaryKey(
                name: "PK_LoginInfo",
                table: "LoginInfo",
                column: "Id");

            migrationBuilder.AddPrimaryKey(
                name: "PK_AdminRole",
                table: "AdminRole",
                column: "Id");

            migrationBuilder.AddPrimaryKey(
                name: "PK_AdminInfo",
                table: "AdminInfo",
                column: "Id");
        }

        protected override void Down(MigrationBuilder migrationBuilder)
        {
            migrationBuilder.DropPrimaryKey(
                name: "PK_RoleMenu",
                table: "RoleMenu");

            migrationBuilder.DropPrimaryKey(
                name: "PK_RoleInfo",
                table: "RoleInfo");

            migrationBuilder.DropPrimaryKey(
                name: "PK_OrganizationInfo",
                table: "OrganizationInfo");

            migrationBuilder.DropPrimaryKey(
                name: "PK_MenuInfo",
                table: "MenuInfo");

            migrationBuilder.DropPrimaryKey(
                name: "PK_LoginInfo",
                table: "LoginInfo");

            migrationBuilder.DropPrimaryKey(
                name: "PK_AdminRole",
                table: "AdminRole");

            migrationBuilder.DropPrimaryKey(
                name: "PK_AdminInfo",
                table: "AdminInfo");

            migrationBuilder.RenameTable(
                name: "RoleMenu",
                newName: "roleMenus");

            migrationBuilder.RenameTable(
                name: "RoleInfo",
                newName: "roleInfos");

            migrationBuilder.RenameTable(
                name: "OrganizationInfo",
                newName: "organizationInfos");

            migrationBuilder.RenameTable(
                name: "MenuInfo",
                newName: "menuInfos");

            migrationBuilder.RenameTable(
                name: "LoginInfo",
                newName: "loginInfos");

            migrationBuilder.RenameTable(
                name: "AdminRole",
                newName: "adminRoles");

            migrationBuilder.RenameTable(
                name: "AdminInfo",
                newName: "adminInfos");

            migrationBuilder.AlterColumn<bool>(
                name: "IsDelete",
                table: "roleMenus",
                nullable: false,
                oldClrType: typeof(bool),
                oldNullable: true);

            migrationBuilder.AlterColumn<bool>(
                name: "IsDelete",
                table: "roleInfos",
                nullable: false,
                oldClrType: typeof(bool),
                oldNullable: true);

            migrationBuilder.AlterColumn<bool>(
                name: "IsDelete",
                table: "organizationInfos",
                nullable: false,
                oldClrType: typeof(bool),
                oldNullable: true);

            migrationBuilder.AlterColumn<bool>(
                name: "IsDelete",
                table: "menuInfos",
                nullable: false,
                oldClrType: typeof(bool),
                oldNullable: true);

            migrationBuilder.AlterColumn<bool>(
                name: "IsDelete",
                table: "loginInfos",
                nullable: false,
                oldClrType: typeof(bool),
                oldNullable: true);

            migrationBuilder.AlterColumn<bool>(
                name: "IsDelete",
                table: "adminRoles",
                nullable: false,
                oldClrType: typeof(bool),
                oldNullable: true);

            migrationBuilder.AlterColumn<string>(
                name: "LoginName",
                table: "adminInfos",
                nullable: true,
                oldClrType: typeof(string),
                oldMaxLength: 50,
                oldNullable: true);

            migrationBuilder.AlterColumn<bool>(
                name: "IsDelete",
                table: "adminInfos",
                nullable: false,
                oldClrType: typeof(bool),
                oldNullable: true);

            migrationBuilder.AddPrimaryKey(
                name: "PK_roleMenus",
                table: "roleMenus",
                column: "Id");

            migrationBuilder.AddPrimaryKey(
                name: "PK_roleInfos",
                table: "roleInfos",
                column: "Id");

            migrationBuilder.AddPrimaryKey(
                name: "PK_organizationInfos",
                table: "organizationInfos",
                column: "Id");

            migrationBuilder.AddPrimaryKey(
                name: "PK_menuInfos",
                table: "menuInfos",
                column: "Id");

            migrationBuilder.AddPrimaryKey(
                name: "PK_loginInfos",
                table: "loginInfos",
                column: "Id");

            migrationBuilder.AddPrimaryKey(
                name: "PK_adminRoles",
                table: "adminRoles",
                column: "Id");

            migrationBuilder.AddPrimaryKey(
                name: "PK_adminInfos",
                table: "adminInfos",
                column: "Id");
        }
    }
}
